import request from '@/utils/request'
// 项目用户相关的请求地址
enum API {
  LOGIN_URL = '/user/login',
  USERINFO_URL = '/user/userInfoListPage/',
  LOGOUT_URL = '/user/logout',
  USERPERMISSION = '/user/role/userPermission',
  DELETEUSERBYID = '/user/deleteUserById/',
  USERINFOBUUSERNAME_URL = '/user/getUserByName/',
  BATCHDELETE_URL = '/user/batchDeleteUser?userIdArr=',
  ADDUSER_URL = '/user/addUserInfo',
  CHANGEUSERSTATUS_URL = '/user/changeStatus/',
}

// 登录接口
export const reqLogin = (data: any) => request.post(API.LOGIN_URL, data)
// 获取用户信息的接口
export const userInfoListPage = (currentPage: number, limit: number) =>
  
 request.get(API.USERINFO_URL + `${currentPage}/${limit}`)

 
// 退出登录
export const reqLogout = () => request.post<any, any>(API.LOGOUT_URL)
// 获取用户的权限信息等
export const reqUserPermission = () => request.get(API.USERPERMISSION)
// 根据id删除用户
export const reqDeleteUserById = (deleteId: number) =>
  request.post(API.DELETEUSERBYID + `${deleteId}`)
  
export const reqUserByName = (
  currentPage: number,
  limit: number,
  username: String,
) =>
  request.get(
    API.USERINFOBUUSERNAME_URL + `${currentPage}/${limit}/${username}`,
  )

export const reqBatchDeleteUser = (ids: any) =>
  request.delete<any, any>(API.BATCHDELETE_URL + `${ids}`)

export const reqAddUser = (userParams: any) =>
  request.post<any, any>(API.ADDUSER_URL, userParams)

export const reqChangeUserStatus = (uId: number, uStatus: number) =>
  request.post<any, any>(API.CHANGEUSERSTATUS_URL + `${uId}/${uStatus}`)
